﻿using System;
using System.Text.RegularExpressions;

namespace Magicodes.Validator
{
    public class MobileValidator
    {
        public const string MobileRegularExpression = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";

        /// <summary>
        /// 隐藏手机号中间四位为*
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public static string MarkPhoneNo(string phone)
        {
            return Regex.Replace(phone, "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); ;
        }
    }
}
